#ifndef __SUBSYSTEM_ELECTRICITY_BASE_H__
#define __SUBSYSTEM_ELECTRICITY_BASE_H__

#include "Subsystems/Subsystem.hpp"
#include "Engine/Point3.hpp"

using namespace PocketSurvival::Engine;

namespace PocketSurvival
{
    struct ComponentPlayer;
    class SubsystemPickables;
    class SubsystemProjectiles;

    class SubsystemExplosionsBase : public Subsystem
    {
    protected:
        struct ExplosionData
        {
            constexpr inline ExplosionData(int32_t x, int32_t y, int32_t z, float thePressure, bool theIsIncendiary) : point(x,y,z), pressure(thePressure), isIncendiary(theIsIncendiary) {}
            Point3 point;
            float pressure;
            bool isIncendiary;
        };

        SubsystemPickables *m_pickables;
        SubsystemProjectiles *m_projectiles;

    public:

        virtual bool tryExplodeBlock(int32_t x, int32_t y, int32_t z, int32_t value);
        virtual void addExplosion(int32_t x, int32_t y, int32_t z, float pressure, bool isIncendiary); 

        virtual const std::string& getName() const override;
        virtual void update(float dt) override;
        virtual void load(const nlohmann::json& json) override;
        virtual void save(nlohmann::json& json) override;
        virtual void saveToMsgJson(nlohmann::json &jsonData) override;

    };
}

#endif